package com.zjitc;

import org.omg.PortableInterceptor.USER_EXCEPTION;
import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;
import sun.text.normalizer.UTF16;

/**
 * Hello world!
 *
 */
public class App 
{
    public static void main( String[] args )
    {

      User user=null;
      try {
        user = new User();
        user.init();
      }finally {
        if (user != null) {
          user.close();
        }
      }

      ApplicationContext context =new ClassPathXmlApplicationContext("demo1.xml");
      Object ul=context.getBean("ul", User.class);
      Object u2=context.getBean("u2", User.class);
      Object u3=context.getBean("u3", User.class);
      Object u4=context.getBean("u4", User.class);
      Object u5=context.getBean("u5", User.class);
      if (ul.equals(u2)){
        System.out.println(ul==u2);
      }
      System.out.println(ul);
      System.out.println(u2);
      System.out.println(u3);
      System.out.println(u4);
      System.out.println(u5);
      ((ClassPathXmlApplicationContext)context).close();
    }
}
